/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package _4_Mapper;

import _3_Object.SendPostObject;
import _5_DB.ConnectDB;
import java.sql.CallableStatement;
import java.sql.Connection;

/**
 *
 * @author DOM
 */
public class SendPostMapper {
    public static int sp(SendPostObject s)
    {
        int retvl=-1;
        try{
            ConnectDB db = new ConnectDB();
            Connection con = db.getConnection();
            CallableStatement proc = null;
            proc = con.prepareCall("{call procGuiBai(?,?,?)}");
            
            proc.setInt(1, s.getUid());
            proc.setString(2, s.getTitle());
            proc.setString(3, s.getContents());
            
            retvl = proc.executeUpdate();
        }
        catch(Exception ex)
        {
            System.out.print("Loi: "+ ex.getMessage());
        }
        return retvl;
    }
}
